/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ipfms.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author fikri
 */
@Entity
@Table(name = "inbox")
@NamedQueries({
    @NamedQuery(name = "Inbox.findAll", query = "SELECT i FROM Inbox i")})
public class Inbox implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_inbox")
    private Integer idInbox;
    
    @Column(name = "title")
    private String title;
    
    @ManyToOne (fetch = FetchType.LAZY)
    @JoinColumn (name = "user_id")
    private Pengguna pengguna;
    
    @ManyToOne (fetch = FetchType.LAZY)
    @JoinColumn (name = "id_building")
    private Building building;
    
    @Basic(optional = false)
    @Column(name = "workflow_id")
    private String workflowId;    
    
    @Column(name = "message")
    private String message;    
    
    @Column(name = "send_date")
    private Date sendDate;
    
    @Basic(optional = false)
    @Column(name = "active")
    private char active;
    
    @Embedded
    private InfoAudit infoAudit;

    public Inbox() {
    }

    public Inbox(Integer idInbox) {
        this.idInbox = idInbox;
    }

    public Inbox(Integer idInbox, String title, Pengguna userId) {
        this.idInbox = idInbox;
        this.title = title;
        this.pengguna = userId;        
    }

    public Integer getIdInbox() {
        return idInbox;
    }

    public void setIdInbox(Integer idInbox) {
        this.idInbox = idInbox;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Pengguna getUserId() {
        return pengguna;
    }

    public void setUserId(Pengguna userId) {
        this.pengguna = userId;
    }

    public InfoAudit getInfoAudit() {
        return infoAudit;
    }

    public void setInfoAudit(InfoAudit infoAudit) {
        this.infoAudit = infoAudit;
    }   

    public Building getBuilding() {
        return building;
    }

    public void setBuilding(Building building) {
        this.building = building;
    }

    public char getActive() {
        return active;
    }

    public void setActive(char active) {
        this.active = active;
    }

    public String getWorkflowId() {
        return workflowId;
    }

    public void setWorkflowId(String workflowId) {
        this.workflowId = workflowId;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Date getSendDate() {
        return sendDate;
    }

    public void setSendDate(Date sendDate) {
        this.sendDate = sendDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInbox != null ? idInbox.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Inbox)) {
            return false;
        }
        Inbox other = (Inbox) object;
        if ((this.idInbox == null && other.idInbox != null) || (this.idInbox != null && !this.idInbox.equals(other.idInbox))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ipfms.model.Inbox[ idInbox=" + idInbox + " ]";
    }
    
}
